package cn.ht.jywrwater.module.ht.dal.mysql.watercount;

import java.util.*;

import cn.ht.jywrwater.framework.common.pojo.PageResult;
import cn.ht.jywrwater.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.ht.jywrwater.framework.mybatis.core.mapper.BaseMapperX;
import cn.ht.jywrwater.module.ht.dal.dataobject.watercount.WaterCountDO;
import org.apache.ibatis.annotations.Mapper;
import cn.ht.jywrwater.module.ht.controller.admin.watercount.vo.*;

/**
 * 水量统计 Mapper
 *
 * @author hzx
 */
@Mapper
public interface WaterCountMapper extends BaseMapperX<WaterCountDO> {

    default PageResult<WaterCountDO> selectPage(WaterCountPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WaterCountDO>()
                .eqIfPresent(WaterCountDO::getWaterType, reqVO.getWaterType())
                .eqIfPresent(WaterCountDO::getYearValue, reqVO.getYearValue())
                .eqIfPresent(WaterCountDO::getMonthValue, reqVO.getMonthValue())
                .betweenIfPresent(WaterCountDO::getDataDate, reqVO.getDataDate())
                .eqIfPresent(WaterCountDO::getWaterCount, reqVO.getWaterCount())
                .betweenIfPresent(WaterCountDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WaterCountDO::getId));
    }

    default List<WaterCountDO> selectList(WaterCountExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<WaterCountDO>()
                .eqIfPresent(WaterCountDO::getWaterType, reqVO.getWaterType())
                .eqIfPresent(WaterCountDO::getYearValue, reqVO.getYearValue())
                .eqIfPresent(WaterCountDO::getMonthValue, reqVO.getMonthValue())
                .betweenIfPresent(WaterCountDO::getDataDate, reqVO.getDataDate())
                .eqIfPresent(WaterCountDO::getWaterCount, reqVO.getWaterCount())
                .betweenIfPresent(WaterCountDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WaterCountDO::getId));
    }

}
